package sol.leetcode;

/**
 * Missing Number
 */
public class Issue268 {
    public int missingNumber(int[] nums) {
        int res = 0;
        for (int i = 0; i < nums.length + 1; ++i)
            res ^= i;
        for (int num : nums)
            res ^= num;
        return res;
    }

    public static void main(String[] args) {
        int[] nums = {0,2,7,5,4, 1, 3};
        System.out.println(new Issue268().missingNumber(nums));
    }
}
